<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        function fn() {
            var arr = ['1','2','3','4','5','6','7','8','9','10','11','12'];
            for (var i =0; i < 4; i++) {
                var arr1 = [];
                for (var j = 0; j < 3; j++) {
                    var num = Math.floor(Math.random()*arr.length);
//                    arr1.push(num);
//                    arr.splice(num,1);
                }
                console.log(num);
            }
        }
    </script>
</head>
<body>
<button onclick="fn()">点击</button>
</body>
</html>